<template>
  <div class="footer">
      <p class="addr" v-show="defaults">©2017 www.thy.com.cn All Rights Reserved. 天化云 版权所有</p>
      <p class="addr" v-show="!defaults">©2017 {{url}} All Rights Reserved. {{footer.short_name}} 版权所有</p>
      <p> <span>联系方式:{{footer.mobile}}</span> <span v-show="footer.address">联系地址{{footer.address}}</span></p>
      
  </div>
</template>
<script>
export default {
    data() {
        return {
            footer: [],
            com_id:localStorage.getItem("companyid"),
            defaults:false,
            url:[]
        }
    },
    methods: {
        loadApi(){
            
            //var api="test2"        
            this.$http.post('http://thy.588net.com/index.php/api/domain/get_domain',{pr:this.api},{emulateJSON: true}).then(function(res){
               
                 var com_ids=res.body.data.company_id;
                 this.com=com_ids; 
               
                
                if(res.body.data.company_id || res.body.code==200){                   
                     var com_id=localStorage.setItem('companyid',com_ids);
                     this.loadFooter();
                }
                if(res.body.code==1002 || res.body.data==''){
                    var com_id=localStorage.setItem('companyid',1); 
                    this.loadFooter();              
                }  
              
            })
        },
       loadFooter:function(){
           var com_id=localStorage.getItem("companyid");
           this.$http.get('http://thy.588net.com/index.php/api/Company/get_company_index?' + '&company_id=' + com_id+'&footer='+2).then(function(res) {
                this.footer=res.body.data.company;
                var url_1=res.body.data.company.website;
                var url_2=url_1.replace(/\//g, "");
                var url_3=url_2.replace(/http:/, "");
                this.url=url_3;
                // console.log(url_1)
                // console.log(this.url)
            })
       }
    },
    mounted() {
        var domain=window.location.href;
        var sec=domain.split(".")[0];
        var secs=sec.replace(/\//g, "");
        var api=secs.replace(/http:/, "");
        this.api=api;

        this.loadApi()
        

    }
}
</script>


<style>
.footer{
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    color: #a5a5a5;
    background: #f5f5f5;
}
.addr{
    margin-bottom:10px
}
</style>

